package com.junqi.msg.adapter;

import com.junqi.common.entity.Message;
import com.junqi.msg.entity.WSBaseResp;
import com.junqi.msg.enums.WSRespTypeEnum;
import org.springframework.stereotype.Component;

import java.util.Set;

@Component
public class WSAdapter {


    public WSBaseResp<String> buildMsgNotifyResp() {
        WSBaseResp<String> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(WSRespTypeEnum.MESSAGE.getType());
        wsBaseResp.setData(WSRespTypeEnum.MESSAGE.getDesc());
        return wsBaseResp;
    }

    public WSBaseResp<Set<Message>> buildChatMsgResp(Set<Message> messageList) {
        WSBaseResp<Set<Message>> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(WSRespTypeEnum.CHAT_MESSAGE.getType());
        wsBaseResp.setData(messageList);
        return wsBaseResp;
    }

    public WSBaseResp<Integer> buildRoomCountMsgResp(Integer count) {
        WSBaseResp<Integer> wsBaseResp = new WSBaseResp<>();
        wsBaseResp.setType(WSRespTypeEnum.ROOM_COUNT.getType());
        wsBaseResp.setData(count);
        return wsBaseResp;
    }
}
